package jgl.vajra.operator.part.home.viewModel;

import java.util.List;
import java.util.Map;

import jgl.vajra.operator.bean.GrabListBean;
import jgl.vajra.operator.bean.GrabOrdersBean;
import jgl.vajra.operator.bean.ReceiptStatisticsBean;
import jgl.vajra.operator.bean.SpeechInfoBean;
import jgl.vajra.operator.netty.GrabOrderBean;
import jgl.vajra.operator.part.home.contract.GrabOrderContract;
import jgl.vajra.operator.part.home.model.GrabOrderModel;
import jgl.vajra.operator.widget.mvvm.factory.CreateModel;
import jgl.vajra.operator.widget.retrofithelper.rxsubscriber.ProgressObserver;
import jgl.vajra.operator.widget.utils.ToastUtils;

@CreateModel(GrabOrderModel.class)
public class GrabOrderViewModel extends GrabOrderContract.ViewModel{

    @Override
    public void getSpeechInfoData(Map<String, Object> map) {
        mModel.getSpeechInfoData(map).subscribe(new ProgressObserver<SpeechInfoBean>(false,null) {
            @Override
            public void _onNext(SpeechInfoBean data) {
                mView.returnSpeechInfoBean(data);
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
            }
        });
    }

    @Override
    public void getMessageOrderData(Map<String, Object> map,String content) {
        mModel.getMessageOrderData(map).subscribe(new ProgressObserver<GrabOrderBean>(false,null) {
            @Override
            public void _onNext(GrabOrderBean data) {
               // mView.returnMessageOrderBean(data,content);
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
            }
        });
    }

    @Override
    public void getGrabOrdersData(Map<String, Object> map) {
        mModel.getGrabOrdersData(map).subscribe(new ProgressObserver<GrabOrdersBean>(true,null) {
            @Override
            public void _onNext(GrabOrdersBean data) {
                mView.returnGrabOrdersData(data);
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
            }
        });
    }

    @Override
    public void getGrabListData(Map<String, Object> map) {
        mModel.getGrabListData(map).subscribe(new ProgressObserver<List<GrabListBean>>(false,null) {
            @Override
            public void _onNext(List<GrabListBean> data) {
                mView.returnGrabListData(data);
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {

            }
        });
    }

    @Override
    public void removeGrabOrderData(Map<String, Object> map) {
        mModel.removeGrabOrderData(map).subscribe(new ProgressObserver<String>(false,null) {
            @Override
            public void _onNext(String data) {
                ToastUtils.showShort(data);
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {

            }
        });
    }

    @Override
    public void getReceiptStatisticsData(Map<String, Object> map) {
        mModel.getReceiptStatisticsData(map).subscribe(new ProgressObserver<List<ReceiptStatisticsBean>>(false,this) {
            @Override
            public void _onNext(List<ReceiptStatisticsBean> data) {
                mView.returnReceiptStatisticsData(data);
            }
        });
    }
}
